package com.xyh.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.xyh.po.Student;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author:kyle
 * @Date:2020/12/23 - 11:42
 * @Project:spring_StudentsDormitoryManagementSystem
 * @Package:com.xyh.dao
 * @Version:1.0
 */
@Repository
public interface StudentDao extends BaseMapper<Student> {

    //展示所有学生信息  //根据条件模糊查询（学生姓名，班级，所在在房间）
    @Select("SELECT  student_pkid,student_name,student_gender,student_tel,c.class_name,h.address from t_student " +
            "INNER JOIN t_home h ON fk_homeid = home_pkid " +
            "INNER JOIN t_class c ON fk_classid = class_pkid " +
            "${ew.customSqlSegment}")
    @ResultMap("com.xyh.dao.StudentDao.studentMap")
    List<Student> queryStudentByWrapper(@Param(Constants.WRAPPER) Wrapper<Student> wrapper);

}
